<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

        body {
            margin: 0;
        }

        img {
            display: block;
        }

        .bg {
            position: absolute;
            height: 100vh;
            width: 100%;
            z-index: -999;
        }

        .container {
            height: 200px;
            width: 1000px;
            position: absolute;
            top: 200px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
        }

        .container img {
            flex: 1;
            height: 100%;
        }

    </style>
</head>
<body>
    <img class="bg" src="https://t7.baidu.com/it/u=1595072465,3644073269&fm=193&f=GIF" alt="">

    <div class="container">
        <img src="https://t7.baidu.com/it/u=1595072465,3644073269&fm=193&f=GIF" alt="">
        <img src="https://t7.baidu.com/it/u=4198287529,2774471735&fm=193&f=GIF" alt="">
        <img src="https://t7.baidu.com/it/u=1956604245,3662848045&fm=193&f=GIF" alt="">
        <img src="https://t7.baidu.com/it/u=2529476510,3041785782&fm=193&f=GIF" alt="">
    </div>


    <script>

        const images = document.querySelectorAll('.container img');
        const bg = document.querySelector('.bg');

        for (const img of images) {
            img.addEventListener('click', function (e) {
                console.log(e);
                const src = this.getAttribute('src'); // 'https://t7.baidu.com/it/u=1595072465,3644073269&fm=193&f=GIF'
                bg.setAttribute('src', src);
            });
        }

    </script>
</body>
</html>